from django.shortcuts import render

# Create your views here.
from common.models import CommonModel
from type.models import CommonTypeModel


def common(request, pk):
    if request.method == 'GET':
        types = CommonTypeModel.objects.all()
        if pk == 'default':
            content = CommonModel.objects.filter()
        else:
            content = CommonModel.objects.filter(pk=pk)
        return render(request, f'{request.session.get("language")}/common.html', locals())

    # pk = request.POST['pk']
    # commons = CommonModel.objects.filter(type=pk).values()
    # return JsonResponse(data=commons, safe=False)
